<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>CUB: warp_scan.cuh Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-38890655-1']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">CUB
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d583f216f1aafe19404e836b0c097ad2.html">cub</a></li><li class="navelem"><a class="el" href="dir_cb3a671affffe7eeb3fdf5ae58e42cc8.html">warp</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">warp_scan.cuh</div>  </div>
</div><!--header-->
<div class="contents">
<a href="warp__scan_8cuh.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2011, Duane Merrill.  All rights reserved.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * modification, are permitted provided that the following conditions are met:</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *     * Redistributions of source code must retain the above copyright</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *     * Redistributions in binary form must reproduce the above copyright</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer in the</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *       documentation and/or other materials provided with the distribution.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *     * Neither the name of the NVIDIA CORPORATION nor the</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *       names of its contributors may be used to endorse or promote products</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *       derived from this software without specific prior written permission.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> ******************************************************************************/</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &quot;specializations/warp_scan_shfl.cuh&quot;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &quot;specializations/warp_scan_smem.cuh&quot;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#include &quot;../thread/thread_operators.cuh&quot;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;../util_arch.cuh&quot;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#include &quot;../util_type.cuh&quot;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#include &quot;../util_namespace.cuh&quot;</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;CUB_NS_PREFIX</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="keyword">namespace </span>cub {</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="keyword">template</span> &lt;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keyword">typename</span>    T,</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="keywordtype">int</span>         LOGICAL_WARPS           = 1,</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="keywordtype">int</span>         LOGICAL_WARP_THREADS    = <a class="code" href="structcub_1_1_arch_props.html#a378def3dee75e77eb135efcf6f0ca063ac5a2eb5b9e3b50dd43ad67c1ff020d9c" title="Log of the number of threads per warp. ">PtxArchProps::WARP_THREADS</a>&gt;</div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html">  145</a></span>&#160;<span class="keyword">class </span><a class="code" href="classcub_1_1_warp_scan.html" title="The WarpScan class provides collective methods for computing a parallel prefix scan of items partitio...">WarpScan</a></div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;{</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="comment">     * Constants and typedefs</span></div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;<span class="comment">     ******************************************************************************/</span></div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="keyword">enum</span></div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    {</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        POW_OF_TWO = ((LOGICAL_WARP_THREADS &amp; (LOGICAL_WARP_THREADS - 1)) == 0),</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    };</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="structcub_1_1_if.html" title="Type selection (IF ? ThenType : ElseType) ">If&lt;(CUB_PTX_ARCH &gt;</a>= 300) &amp;&amp; ((LOGICAL_WARPS == 1) || POW_OF_TWO),</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        WarpScanShfl&lt;T, LOGICAL_WARPS, LOGICAL_WARP_THREADS&gt;,</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        WarpScanSmem&lt;T, LOGICAL_WARPS, LOGICAL_WARP_THREADS&gt; &gt;::Type InternalWarpScan;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    <span class="keyword">typedef</span> <span class="keyword">typename</span> InternalWarpScan::TempStorage _TempStorage;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="comment">     * Thread fields</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="comment">     ******************************************************************************/</span></div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    _TempStorage &amp;temp_storage;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    <span class="keywordtype">int</span> warp_id;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <span class="keywordtype">int</span> lane_id;</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="comment">     * Utility methods</span></div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="comment">     ******************************************************************************/</span></div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    __device__ __forceinline__ _TempStorage&amp; PrivateStorage()</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    {</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        __shared__ <a class="code" href="structcub_1_1_warp_scan_1_1_temp_storage.html" title="The operations exposed by WarpScan require a temporary memory allocation of this nested type for thre...">TempStorage</a> private_storage;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        <span class="keywordflow">return</span> private_storage;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    }</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;</div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="code" href="structcub_1_1_warp_scan_1_1_temp_storage.html">  196</a></span>&#160;    <span class="keyword">struct </span><a class="code" href="structcub_1_1_warp_scan_1_1_temp_storage.html" title="The operations exposed by WarpScan require a temporary memory allocation of this nested type for thre...">TempStorage</a> : <a class="code" href="structcub_1_1_uninitialized.html" title="A storage-backing wrapper that allows types with non-trivial constructors to be aliased in unions...">Uninitialized</a>&lt;_TempStorage&gt; {};</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;</div>
<div class="line"><a name="l00207"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a27ca414b95f92f2b52701cda45273b05">  207</a></span>&#160;    __device__ __forceinline__ <a class="code" href="classcub_1_1_warp_scan.html#a27ca414b95f92f2b52701cda45273b05" title="Collective constructor for 1D thread blocks using a private static allocation of shared memory as tem...">WarpScan</a>()</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    :</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        temp_storage(PrivateStorage()),</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        warp_id((LOGICAL_WARPS == 1) ?</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;            0 :</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;            threadIdx.x / LOGICAL_WARP_THREADS),</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        lane_id(((LOGICAL_WARPS == 1) || (LOGICAL_WARP_THREADS == <a class="code" href="structcub_1_1_ptx_arch_props.html" title="The architectural properties for the PTX version targeted by the active compiler pass. ">PtxArchProps</a>::WARP_THREADS)) ?</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;            LaneId() :</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;            threadIdx.x % LOGICAL_WARP_THREADS)</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    {}</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div>
<div class="line"><a name="l00222"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a037e31be8f0e394e2b7a6ce02f24042e">  222</a></span>&#160;    __device__ __forceinline__ <a class="code" href="classcub_1_1_warp_scan.html#a037e31be8f0e394e2b7a6ce02f24042e" title="Collective constructor for 1D thread blocks using the specified memory allocation as temporary storag...">WarpScan</a>(</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;        <a class="code" href="structcub_1_1_warp_scan_1_1_temp_storage.html" title="The operations exposed by WarpScan require a temporary memory allocation of this nested type for thre...">TempStorage</a> &amp;temp_storage)             </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    :</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        temp_storage(temp_storage.Alias()),</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;        warp_id((LOGICAL_WARPS == 1) ?</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;            0 :</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;            threadIdx.x / LOGICAL_WARP_THREADS),</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;        lane_id(((LOGICAL_WARPS == 1) || (LOGICAL_WARP_THREADS == <a class="code" href="structcub_1_1_ptx_arch_props.html" title="The architectural properties for the PTX version targeted by the active compiler pass. ">PtxArchProps</a>::WARP_THREADS)) ?</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;            LaneId() :</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;            threadIdx.x % LOGICAL_WARP_THREADS)</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;    {}</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div>
<div class="line"><a name="l00238"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#aa8e1da90057f72813e2ad36af598dcc2">  238</a></span>&#160;    __device__ __forceinline__ <a class="code" href="classcub_1_1_warp_scan.html#aa8e1da90057f72813e2ad36af598dcc2" title="Collective constructor using a private static allocation of shared memory as temporary storage...">WarpScan</a>(</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <span class="keywordtype">int</span> warp_id,                           </div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;        <span class="keywordtype">int</span> lane_id)                           </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;    :</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        temp_storage(PrivateStorage()),</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;        warp_id(warp_id),</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        lane_id(lane_id)</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    {}</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;</div>
<div class="line"><a name="l00251"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a9787551c8a6e2a23f9d32cd029151093">  251</a></span>&#160;    __device__ __forceinline__ <a class="code" href="classcub_1_1_warp_scan.html#a9787551c8a6e2a23f9d32cd029151093" title="Collective constructor using the specified memory allocation as temporary storage. Threads are identified using the given warp and lane identifiers. ">WarpScan</a>(</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        <a class="code" href="structcub_1_1_warp_scan_1_1_temp_storage.html" title="The operations exposed by WarpScan require a temporary memory allocation of this nested type for thre...">TempStorage</a> &amp;temp_storage,             </div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;        <span class="keywordtype">int</span> warp_id,                           </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        <span class="keywordtype">int</span> lane_id)                           </div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    :</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        temp_storage(temp_storage.Alias()),</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;        warp_id(warp_id),</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        lane_id(lane_id)</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    {}</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div>
<div class="line"><a name="l00300"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27">  300</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27" title="Computes an inclusive prefix sum in each logical warp. ">InclusiveSum</a>(</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;        T               input,              </div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        T               &amp;output)            </div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    {</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).InclusiveSum(input, output);</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    }</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;</div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a601da756b6729894ec8a52080d920cd4">  342</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a601da756b6729894ec8a52080d920cd4" title="Computes an inclusive prefix sum in each logical warp. Also provides every thread with the warp-wide ...">InclusiveSum</a>(</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        T               input,              </div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;        T               &amp;warp_aggregate)    </div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    {</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).InclusiveSum(input, output, warp_aggregate);</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;    }</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l00426"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a906d0d6381b3af1ad105ec69547350f3">  426</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a906d0d6381b3af1ad105ec69547350f3" title="Computes an inclusive prefix sum in each logical warp. Instead of using 0 as the warp-wide prefix...">InclusiveSum</a>(</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;        T               input,              </div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;        T               &amp;warp_aggregate,    </div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;        WarpPrefixOp    &amp;warp_prefix_op)    </div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;    {</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;        <span class="comment">// Compute inclusive warp scan</span></div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27" title="Computes an inclusive prefix sum in each logical warp. ">InclusiveSum</a>(input, output, warp_aggregate);</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;        <span class="comment">// Compute warp-wide prefix from aggregate, then broadcast to other lanes</span></div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;        T prefix;</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;        prefix = warp_prefix_op(warp_aggregate);</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;        prefix = InternalWarpScan(temp_storage, warp_id, lane_id).Broadcast(prefix, 0);</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;        <span class="comment">// Update output</span></div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;        output = prefix + output;</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;    }</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, <a class="code" href="structcub_1_1_int2_type.html" title="Allows for the treatment of an integral constant as a type at compile-time (e.g., to achieve static c...">Int2Type&lt;true&gt;</a> is_primitive)</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;    {</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;        <span class="comment">// Compute exclusive warp scan from inclusive warp scan</span></div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;        T inclusive;</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27" title="Computes an inclusive prefix sum in each logical warp. ">InclusiveSum</a>(input, inclusive);</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;        output = inclusive - input;</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;    }</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;</div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, Int2Type&lt;false&gt; is_primitive)</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;    {</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;        <span class="comment">// Delegate to regular scan for non-primitive types (because we won&#39;t be able to use subtraction)</span></div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;        T identity = T();</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(input, output, identity, Sum());</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;    }</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;</div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, T &amp;warp_aggregate, Int2Type&lt;true&gt; is_primitive)</div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;    {</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;        <span class="comment">// Compute exclusive warp scan from inclusive warp scan</span></div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;        T inclusive;</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27" title="Computes an inclusive prefix sum in each logical warp. ">InclusiveSum</a>(input, inclusive, warp_aggregate);</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;        output = inclusive - input;</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;    }</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, T &amp;warp_aggregate, Int2Type&lt;false&gt; is_primitive)</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;    {</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        <span class="comment">// Delegate to regular scan for non-primitive types (because we won&#39;t be able to use subtraction)</span></div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;        T identity = T();</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(input, output, identity, Sum(), warp_aggregate);</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;    }</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, T &amp;warp_aggregate, WarpPrefixOp &amp;warp_prefix_op, Int2Type&lt;true&gt; is_primitive)</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;    {</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;        <span class="comment">// Compute exclusive warp scan from inclusive warp scan</span></div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;        T inclusive;</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#a64d246eb963f9a18d964e17a6f73fc27" title="Computes an inclusive prefix sum in each logical warp. ">InclusiveSum</a>(input, inclusive, warp_aggregate, warp_prefix_op);</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;        output = inclusive - input;</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    }</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> ExclusiveSum(T input, T &amp;output, T &amp;warp_aggregate, WarpPrefixOp &amp;warp_prefix_op, Int2Type&lt;false&gt; is_primitive)</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    {</div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;        <span class="comment">// Delegate to regular scan for non-primitive types (because we won&#39;t be able to use subtraction)</span></div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;        T identity = T();</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(input, output, identity, Sum(), warp_aggregate, warp_prefix_op);</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;    }</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;</div>
<div class="line"><a name="l00547"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#acf4960fcb08e5960ca7c9aa28a34ae1c">  547</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#acf4960fcb08e5960ca7c9aa28a34ae1c" title="Computes an exclusive prefix sum in each logical warp. ">ExclusiveSum</a>(</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;        T               input,              </div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;        T               &amp;output)            </div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;    {</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;        ExclusiveSum(input, output, <a class="code" href="structcub_1_1_int2_type.html" title="Allows for the treatment of an integral constant as a type at compile-time (e.g., to achieve static c...">Int2Type</a>&lt;<a class="code" href="structcub_1_1_traits.html" title="Type traits. ">Traits&lt;T&gt;::PRIMITIVE</a>&gt;());</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;    }</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;</div>
<div class="line"><a name="l00592"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#ab68084364e2235b53998861731b267f8">  592</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#ab68084364e2235b53998861731b267f8" title="Computes an exclusive prefix sum in each logical warp. Also provides every thread with the warp-wide ...">ExclusiveSum</a>(</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;        T               input,              </div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        T               &amp;warp_aggregate)    </div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    {</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;        ExclusiveSum(input, output, warp_aggregate, <a class="code" href="structcub_1_1_int2_type.html" title="Allows for the treatment of an integral constant as a type at compile-time (e.g., to achieve static c...">Int2Type</a>&lt;<a class="code" href="structcub_1_1_traits.html" title="Type traits. ">Traits&lt;T&gt;::PRIMITIVE</a>&gt;());</div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;    }</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;</div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l00679"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a283236673ad2e54579f6b5ee97eac193">  679</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a283236673ad2e54579f6b5ee97eac193" title="Computes an exclusive prefix sum in each logical warp. Instead of using 0 as the warp-wide prefix...">ExclusiveSum</a>(</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;        T               input,              </div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;        T               &amp;warp_aggregate,    </div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;        WarpPrefixOp    &amp;warp_prefix_op)    </div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160;    {</div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;        ExclusiveSum(input, output, warp_aggregate, warp_prefix_op, <a class="code" href="structcub_1_1_int2_type.html" title="Allows for the treatment of an integral constant as a type at compile-time (e.g., to achieve static c...">Int2Type</a>&lt;<a class="code" href="structcub_1_1_traits.html" title="Type traits. ">Traits&lt;T&gt;::PRIMITIVE</a>&gt;());</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;    }</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l00731"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#aafd14f3920c493b104a3a6a0cc6a39d2">  731</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#aafd14f3920c493b104a3a6a0cc6a39d2" title="Computes an inclusive prefix sum using the specified binary scan functor in each logical warp...">InclusiveScan</a>(</div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;        T               input,              </div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160;        ScanOp          scan_op)            </div>
<div class="line"><a name="l00735"></a><span class="lineno">  735</span>&#160;    {</div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).InclusiveScan(input, output, scan_op);</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;    }</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;</div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l00780"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a6a2ac5f642393ccfc698aa515e192a22">  780</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a6a2ac5f642393ccfc698aa515e192a22" title="Computes an inclusive prefix sum using the specified binary scan functor in each logical warp...">InclusiveScan</a>(</div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;        T               input,              </div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;        T               &amp;warp_aggregate)    </div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;    {</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).InclusiveScan(input, output, scan_op, warp_aggregate);</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;    }</div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;</div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;    <span class="keyword">template</span> &lt;</div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;        <span class="keyword">typename</span> ScanOp,</div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;        <span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l00869"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#adf74795dbe02947facd24657bc519c40">  869</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#adf74795dbe02947facd24657bc519c40" title="Computes an inclusive prefix sum using the specified binary scan functor in each logical warp...">InclusiveScan</a>(</div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;        T               input,              </div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;        T               &amp;warp_aggregate,    </div>
<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;        WarpPrefixOp    &amp;warp_prefix_op)    </div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;    {</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;        <span class="comment">// Compute inclusive warp scan</span></div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafd14f3920c493b104a3a6a0cc6a39d2" title="Computes an inclusive prefix sum using the specified binary scan functor in each logical warp...">InclusiveScan</a>(input, output, scan_op, warp_aggregate);</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;</div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;        <span class="comment">// Compute warp-wide prefix from aggregate, then broadcast to other lanes</span></div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;        T prefix;</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;        prefix = warp_prefix_op(warp_aggregate);</div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;        prefix = InternalWarpScan(temp_storage, warp_id, lane_id).Broadcast(prefix, 0);</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;        <span class="comment">// Update output</span></div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;        output = scan_op(prefix, output);</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;    }</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;</div>
<div class="line"><a name="l00930"></a><span class="lineno">  930</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l00931"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625">  931</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l00932"></a><span class="lineno">  932</span>&#160;        T               input,              </div>
<div class="line"><a name="l00933"></a><span class="lineno">  933</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00934"></a><span class="lineno">  934</span>&#160;        T               identity,           </div>
<div class="line"><a name="l00935"></a><span class="lineno">  935</span>&#160;        ScanOp          scan_op)            </div>
<div class="line"><a name="l00936"></a><span class="lineno">  936</span>&#160;    {</div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).ExclusiveScan(input, output, identity, scan_op);</div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;    }</div>
<div class="line"><a name="l00939"></a><span class="lineno">  939</span>&#160;</div>
<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;</div>
<div class="line"><a name="l00978"></a><span class="lineno">  978</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l00979"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a09d36c6cf146b69c1cf91d4781b96374">  979</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a09d36c6cf146b69c1cf91d4781b96374" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l00980"></a><span class="lineno">  980</span>&#160;        T               input,              </div>
<div class="line"><a name="l00981"></a><span class="lineno">  981</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;        T               identity,           </div>
<div class="line"><a name="l00983"></a><span class="lineno">  983</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l00984"></a><span class="lineno">  984</span>&#160;        T               &amp;warp_aggregate)    </div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;    {</div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).ExclusiveScan(input, output, identity, scan_op, warp_aggregate);</div>
<div class="line"><a name="l00987"></a><span class="lineno">  987</span>&#160;    }</div>
<div class="line"><a name="l00988"></a><span class="lineno">  988</span>&#160;</div>
<div class="line"><a name="l00989"></a><span class="lineno">  989</span>&#160;</div>
<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>&#160;    <span class="keyword">template</span> &lt;</div>
<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>&#160;        <span class="keyword">typename</span> ScanOp,</div>
<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>&#160;        <span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l01069"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#ada12695322d9e1f5354fcae9d0910113"> 1069</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#ada12695322d9e1f5354fcae9d0910113" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;        T               input,              </div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;        T               identity,           </div>
<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>&#160;        T               &amp;warp_aggregate,    </div>
<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>&#160;        WarpPrefixOp    &amp;warp_prefix_op)    </div>
<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>&#160;    {</div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;        <span class="comment">// Exclusive warp scan</span></div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(input, output, identity, scan_op, warp_aggregate);</div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;</div>
<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;        <span class="comment">// Compute warp-wide prefix from aggregate, then broadcast to other lanes</span></div>
<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;        T prefix = warp_prefix_op(warp_aggregate);</div>
<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;        prefix = InternalWarpScan(temp_storage, warp_id, lane_id).Broadcast(prefix, 0);</div>
<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>&#160;</div>
<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160;        <span class="comment">// Update output</span></div>
<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>&#160;        output = (lane_id == 0) ?</div>
<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>&#160;            prefix :</div>
<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>&#160;            scan_op(prefix, output);</div>
<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>&#160;    }</div>
<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>&#160;</div>
<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>&#160;</div>
<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>&#160;    <span class="comment">/******************************************************************/</span></div>
<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>&#160;</div>
<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>&#160;</div>
<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l01135"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a1f4e88a801bdfdfde342f23fb2768ea8"> 1135</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a1f4e88a801bdfdfde342f23fb2768ea8" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>&#160;        T               input,              </div>
<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>&#160;        ScanOp          scan_op)            </div>
<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>&#160;    {</div>
<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).ExclusiveScan(input, output, scan_op);</div>
<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>&#160;    }</div>
<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>&#160;</div>
<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>&#160;</div>
<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ScanOp&gt;</div>
<div class="line"><a name="l01182"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#af51aef1f68a2ca876f7515b6b3213d72"> 1182</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#af51aef1f68a2ca876f7515b6b3213d72" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>&#160;        T               input,              </div>
<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>&#160;        T               &amp;warp_aggregate)    </div>
<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>&#160;    {</div>
<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>&#160;        InternalWarpScan(temp_storage, warp_id, lane_id).ExclusiveScan(input, output, scan_op, warp_aggregate);</div>
<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>&#160;    }</div>
<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>&#160;</div>
<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>&#160;</div>
<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>&#160;    <span class="keyword">template</span> &lt;</div>
<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>&#160;        <span class="keyword">typename</span> ScanOp,</div>
<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>&#160;        <span class="keyword">typename</span> WarpPrefixOp&gt;</div>
<div class="line"><a name="l01271"></a><span class="lineno"><a class="code" href="classcub_1_1_warp_scan.html#a024d74c48e45b489843053097b0638d1"> 1271</a></span>&#160;    __device__ __forceinline__ <span class="keywordtype">void</span> <a class="code" href="classcub_1_1_warp_scan.html#a024d74c48e45b489843053097b0638d1" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(</div>
<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>&#160;        T               input,              </div>
<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>&#160;        T               &amp;output,            </div>
<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>&#160;        ScanOp          scan_op,            </div>
<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>&#160;        T               &amp;warp_aggregate,    </div>
<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>&#160;        WarpPrefixOp    &amp;warp_prefix_op)    </div>
<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>&#160;    {</div>
<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>&#160;        <span class="comment">// Exclusive warp scan</span></div>
<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>&#160;        <a class="code" href="classcub_1_1_warp_scan.html#aafbc42fcea0a11b83289629554cbe625" title="Computes an exclusive prefix scan using the specified binary scan functor in each logical warp...">ExclusiveScan</a>(input, output, scan_op, warp_aggregate);</div>
<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>&#160;</div>
<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>&#160;        <span class="comment">// Compute warp-wide prefix from aggregate, then broadcast to other lanes</span></div>
<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>&#160;        T prefix = warp_prefix_op(warp_aggregate);</div>
<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>&#160;        prefix = InternalWarpScan(temp_storage, warp_id, lane_id).Broadcast(prefix, 0);</div>
<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>&#160;</div>
<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>&#160;        <span class="comment">// Update output with prefix</span></div>
<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>&#160;        output = (lane_id == 0) ?</div>
<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>&#160;            prefix :</div>
<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>&#160;            scan_op(prefix, output);</div>
<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>&#160;    }</div>
<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>&#160;</div>
<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>&#160;};</div>
<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>&#160;       <span class="comment">// end group WarpModule</span></div>
<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>&#160;</div>
<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>&#160;}               <span class="comment">// CUB namespace</span></div>
<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>&#160;CUB_NS_POSTFIX  <span class="comment">// Optional outer namespace(s)</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Aug 23 2013 17:31:10 for CUB by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
<br>
&copy; 2013 NVIDIA Corporation
</small></address>
</body>
</html>
